package com.wit.locker.service;

import com.wit.locker.domain.User;
import com.wit.locker.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by linuxyf on 2018/8/14.
 */
@Service
public class UserService {
    @Autowired
    private UserRepository userRepo;

    public User AuthUser(User user) {
        user.setId(null);
        List<User> userList = userRepo.findAll(Example.of(user));
        if(userList != null && userList.size() > 0) {
            return userList.get(0);
        }
        return null;
    }

}
